import pandas as pd


def read_update_label(ser):
    # 获取单个数据
    ser["ace"] = "peace"
    # 获取多个数据嵌套列表
    print(ser[["ace", "face"]])
    # 获取多个数据切片形式
    print(ser["ace":"pace"])  # 包含尾部


def read_update_integer(ser):
    # 获取单个数据,索引
    print(ser[2])
    # 获取多个数据
    ser[[0, 2, 3]] = "commonplace"
    # 获取多个数据切片方式
    print(ser[:2])


if __name__ == '__main__':
    dic = pd.Series({"ace": "menace", "face": "facet", "pace": "pacemaker",
                     "race": "terrace"})

    # read_update_label(dic)
    read_update_integer(dic)
    print(dic)